//
//  AUExtension_BarButtonItem.swift
//  AwesomeUBaseModule
//
//  Created by Miss_Special on 2018/5/10.
//

public extension UIBarButtonItem {
    
    convenience init(normalImage: UIImage, highlightedImage: UIImage, target: Any?, action: Selector, controlEvents: UIControlEvents) {
        self.init()
        
        let button = UIButton()
        button.setImage(normalImage, for: .normal)
        button.setImage(highlightedImage, for: .highlighted)
        button.sizeToFit()
        button.addTarget(target, action: action, for: controlEvents)
        
        self.customView = button
    }
}
